package cn.flant.db.hdle;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class ArrayHandler implements ResultSetHandler<List<Object[]>> {

	public List<Object[]> handle(ResultSet rs) throws SQLException {
		if (rs == null) {
			return null;
		}
		int col = rs.getMetaData().getColumnCount();
		List<Object[]> list = new ArrayList<Object[]>();
		while (rs.next()) {
			Object[] cols = new Object[col];
			for (int i = 1; i <= col; i++) {
				cols[i - 1] = rs.getObject(i);
			}
			list.add(cols);
		}
		return list;
	}

}
